﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Niknak.Services.ServiceCore.Msmq
{
    public sealed class ThrottleItem<MessageTypeEnum>
        where MessageTypeEnum : struct, IComparable, IConvertible, IFormattable //see http://stackoverflow.com/questions/6438352/using-enum-as-generic-type-parameter-in-c-sharp
    {
        /// <summary>
        /// This is the Enum value used by the Processor delegate to do different things based on queue message type
        /// </summary>
        internal MessageTypeEnum _MessageType;
        internal string _MessageId;
        internal DateTime _Expire;

        internal ThrottleItem(MessageTypeEnum messageType, string messageId, DateTime expire)
        {
            if (!typeof(MessageTypeEnum).IsEnum)
                throw new Exception("The '" + typeof(MessageTypeEnum).ToString() + "' type must be an Enum");

            _MessageType = messageType;
            _MessageId = messageId;
            _Expire = expire;
        }
    }
}
